package com.lingxu.base.system.manage.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lingxu.base.system.manage.entity.SysDepart;
import com.lingxu.base.system.manage.model.SysDepartTree;
import com.lingxu.base.system.manage.model.SysDepartUserTree;
import com.lingxu.base.system.orgManage.vo.ParentTree;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @Description: 部门信息
 * @Author: LingXu
 * @Date:   2021-01-04
 * @Version: V1.0.1
 */
public interface SysDepartMapper extends BaseMapper<SysDepart> {

    /**
     * 部门信息-分页列表查询
     * @param page 分页信息
     * @param sysDepart 部门信息
     * @return 部门信息列表
     */
    IPage<SysDepart> queryList(@Param("page") Page<SysDepart> page, @Param("sysDepart") SysDepart sysDepart);

    List<ParentTree> findDepartTreeByPid(String pid) ;

    List<ParentTree> findDepartTreeByPidAndEarlyWarn(String pid) ;

    List<ParentTree> findDepartTreeByLogin() ;
    /**
     * 部门信息-列表查询
     * @param sysDepart 部门信息
     * @return 部门信息列表
     */
    List<SysDepart> queryList(@Param("sysDepart") SysDepart sysDepart);


    List<SysDepartTree> getSysDepartTreeAll();

    List<SysDepartUserTree> getSysDepartUserTreeAll();

    List<SysDepart> getDepsByDeptPid(@Param("pid")String pid);

    void updateBatchSortById(@Param("list") List<SysDepart> list);

    void updateSortById(@Param("depart") SysDepart depart);

    String getCityNameByRgion(@Param("region") String region);

    String getDictValueByDictNameAndDictCode(@Param("dictname") String dictname,@Param("dictcode") String dictcode);

    int findOne(String ename);
}
